<?php
namespace app\api\validate;
use think\Validate;

class Tool extends Validate
{
    protected $rule = [
        'toolid'        =>  'require|number',
        'catid'         =>  'require|number',
        'text'          =>  'require',
        'format'        =>  'require|in:pcm,wav,mp3',
        'sample_rate'   =>  'require|in:16000,8000',
    ];

    protected $message = [
        'toolid.require'        => '工具ID不能为空!',
        'toolid.number'         => '工具ID参数错误!',
        'catid.require'         => '工具分类ID不能为空!',
        'catid.number'          => '工具分类ID参数错误!',
        'text.require'          => '文本内容不能为空!',
        'format.require'        => '音频编码格式参数不能为空!',
        'format.in'             => '音频编码格式参数错误!',
        'sample_rate.require'   => '音频采样率参数不能为空!',
        'sample_rate.in'        => '音频采样率参数错误!',
    ];

    protected $scene = [
        'voice'         =>  ['text','format','sample_rate','toolid','catid'],
    ];    
}